﻿<UserControl x:Class="Zen4SyncDashboard.View.CreateTestSessionView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             Background="{DynamicResource ApplicationBackgroundBrush}">
    <DockPanel LastChildFill="True">
        <Label DockPanel.Dock="Top" Style="{DynamicResource ViewTitle}" Content="Test Session Creation"/>
        <StackPanel>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="200"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="200"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Label Content="Test Session Name"/>
                <Label Content="Test Session Category" Grid.Row="1"/>
                <TextBox Grid.Column="1" Text="{Binding Path=NewTestSession.testSession_name, ValidatesOnDataErrors=True}"/>
                <ComboBox Grid.Column="1" Grid.Row="1" ItemsSource="{Binding Path=TestSessionCategories}" DisplayMemberPath="testSessionCategory_name" SelectedItem="{Binding Path=NewTestSession.testSessionCategory, ValidatesOnDataErrors=True}"/>
                <Button Grid.Column="2" Grid.RowSpan="2" Content="Create Test Session" Command="{Binding Path=AddNewTestSessionCommand}"/>
            </Grid>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="5*"/>
                    <ColumnDefinition Width="5*"/>
                </Grid.ColumnDefinitions>
                <ListBox ItemsSource="{Binding Path=NewTestSession.clientSessions}" DisplayMemberPath="clientSession_name"/>
                <Grid Grid.Column="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="5*"/>
                        <ColumnDefinition Width="5*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Label Grid.Row="0" Content="Name"/>
                    <Label Grid.Row="1" Content="Test Server"/>
                    <Label Grid.Row="2" Content="Enable log"/>
                    <Label Grid.Row="3" Content="Start Date"/>
                    <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Path=NewClientSession.clientSession_name, ValidatesOnDataErrors=True}"/>
                    <ComboBox Grid.Row="1" Grid.Column="1" ItemsSource="{Binding Path=TestServers}" DisplayMemberPath="testServer_name" SelectedItem="{Binding Path=NewClientSession.testServer, ValidatesOnDataErrors=True}"/>
                    <TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Path=NewClientSession.clientSession_enableLog, ValidatesOnDataErrors=True}"/>
                    <TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Path=NewClientSession.clientSession_startDateTime, ValidatesOnDataErrors=true}"/>
                </Grid>
            </Grid>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="200"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Label Content="Test Scenario"/>
                <ComboBox x:Name="TestScenariosComboBox" Grid.Column="1" Grid.Row="1" ItemsSource="{Binding Path=TestScenarios}" DisplayMemberPath="testScenario_name" SelectedItem="{Binding Path=NewClientSession.testScenario, ValidatesOnDataErrors=True}"/>
            </Grid>
            <ListBox VerticalAlignment="Stretch" ItemsSource="{Binding Path=SelectedItem.activities, ElementName=TestScenariosComboBox}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="5*"/>
                                <ColumnDefinition Width="5*"/>
                            </Grid.ColumnDefinitions>
                            <Label Grid.Column="0" Content="{Binding Path=activity_id}"/>
                            <ComboBox Grid.Column="1" ItemsSource="{Binding Path=AvailableContextItemIds}" SelectedItem="{Binding Path=CurrentContextItemId}"/>
                        </Grid>
                    </DataTemplate>                    
                </ListBox.ItemTemplate>
            </ListBox>
            <Button Content="Add Client" Command="{Binding Path=AddNewClientSessionCommand}"/>
        </StackPanel>
    </DockPanel>
</UserControl>
